import cherrypy
from CoreFunctions import GetConfig, GetSetting

class MovieDetails():
    def __init__(self):
        self.DBName         = ""
        self.MovieFolder    = ""
        self.MovieTypes     = []
        self.Mode           = 1     #update mode
        self.OSSeperator    = "/"
           
        if GetConfig('settings.ini'):
            self.MovieFolder    = GetSetting("MovieDatabase", "MovieFolder")    #"/Movies" #"c:\\temp\\temp"
            self.MovieTypes     = GetSetting("MovieDatabase", "MovieTypes")     #['avi', 'mkv', 'mp4']
            self.DBName         = GetSetting("MovieDatabase", "DBName")         #"/Movies/Python/MovieDB.db"
            self.OSSeperator    = GetSetting("MovieDatabase", "OSSeperator")    
            self.LogFile        = GetSetting("MovieDatabase", "LogFile")
        self.cn = sqlite3.connect(self.DBName)
    
    
    def index(self, movieid):
        yield("ID is %s" % movieid)
        
    main.exposed = True 
    
settings = {
           'global': {
            'server.socket_port' : 8080,
            'server.socket_host': "",
            'server.socket_file': "",
            'server.socket_queue_size': 5,
            'server.protocol_version': "HTTP/1.0",
            'server.log_to_screen': True,
            'server.log_file': "",
            'server.reverse_dns': False,
            'server.thread_pool': 10,
            'server.environment': "development",
            'static_filter.root': "/Movies",
            'logDebugInfoFilter.logBuildTime': False,
            'logDebugInfoFilter.logPageSize': False 
            }, 
            '/':{
            'static_filter.on': True,
            'static_filter.dir': "/"     
            }
            }

cherrypy.root = MovieDetails()
#cherrypy.config.update(settings)
#cherrypy.server.start()     